package dbLayer;

import java.sql.SQLException;
import java.util.List;

import modelLayer.Teacher;

public interface DBTeacherIF {
	
	/**
	 * Inserts a new row into the database table. This method
	 * uses prepared statements to sanitize the database input.
	 * 
	 * @param 	t	Teacher		the teacher object to be inserted in the database
	 * @return 	rc 	int 		count of rows affected by the query execution in the database		
	 * @throws 		Exception
	 */
	public int insert(Teacher t) throws SQLException;
	
	/**
	 * Finds a row in the database table Teacher. 
	 * 
	 * @param	name		String			teacher name.
	 * @throws				Exception		throws SQL exceptions if the query isn't
	 * 										legal.
	 * @return				List<Teacher>	returns the teachers matching the search.
	 */
	public List<Teacher> find(String name) throws Exception;
	
	/**
	 * Finds a row in the database table Teacher. 
	 * 
	 * @param	id			int				teacher id.
	 * @throws				Exception		throws SQL exceptions if the query isn't
	 * 										legal.
	 * @return				List<Teacher>	returns the teachers matching the search.
	 */
	public Teacher findById(int id);
	
	/**
	 * Finds all rows in the database table Teacher. 
	 * 
	 * @throws				Exception		throws SQL exceptions if the query isn't
	 * 										legal.
	 * @return				List<Teacher>	returns a list of all teachers.
	 */
	public List<Teacher> getAll();
	
	/**
	 *  Updates a row in the database table Teacher.
	 * 
	 * @param 	id			int		id of the teacher	
	 * @param 	name		String	name of the teacher	
	 * @param 	cpr			String	ssn of the teacher
	 * @param 	address		String	teacher address
	 * @param 	phone		String	teacher phone number
	 * @param 	email		String	teacher e-mail
	 * @param 	hours		String	number of hours per week the teacher works
	 * @return 	rc 			int		count of rows affected by the query execution in the database	
	 * @throws 				Exception
	 */
	public int update(int id, String name, String cpr, String address, String phone,
				      String email, int hours) throws SQLException;
	
	/**
	 * Removes a row in the database table Teacher.
	 * 
	 * @param 	id			int			id of the teacher
	 * @return	rc			int			count of rows affected by the query execution in the database
	 * @throws 				Exception
	 */
	public int remove(int id) throws Exception;
	
}